package com.snopy.designPattern.structure.flyweight;

import java.awt.*;
import java.util.HashMap;
import java.util.Map;

/**
 * @author snopy
 * @version 1.0.0
 * @classname TreeFactory
 * @description
 * @email 77912204@qq.com
 * @date 2022/11/27 20:48
 */
public class TreeFactory {

    static Map<String,TreeType> treeTypes = new HashMap<>();

    public static TreeType getTreeType(String name, Color color,String otherTreeData){
        TreeType result = treeTypes.get(name);
        if (result == null){
            result = new TreeType(name,color,otherTreeData);
            treeTypes.put(name,result);
        }
        return result;
    }

}
